package com.framework.common.auto;

import com.framework.common.enums.IEnum;
import lombok.AllArgsConstructor;

import java.io.Serializable;

/**
 * @author lihanbo
 * @date 2021/10/12 13:09
 */
@AllArgsConstructor
public enum UserStatus implements IEnum, Serializable {
    //用户状态
    status1("1", "正常"),
    status2("2", "已禁用"),
    status4("4", "未激活"),
    status5("5", "退出企业");

    private String val;
    private String name;

    @Override
    public String getVal() {
        return val;
    }

    @Override
    public String getName() {
        return name;
    }

    public static UserStatus getEnumByKey(String val) {
        for (UserStatus temp : UserStatus.values()) {
            if (temp.getVal().toString().equals(val)) {
                return temp;
            }
        }
        throw new RuntimeException("枚举不存在");
    }
}
